jvc ={
	  js:[],
	  jsuse:[],		
	  jsloaded   : [],
	  jsAllLoded : false,
	   baseUrl    : "",
	   notIE : -[1,],
	init : function(cb,isAuto){	
	
		jvc_ready(cb,isAuto);		
	
	},
	
	init_execute : function(cb,isAuto){			
	
		if(!isAuto)this.jsAllLoded=false;
		for(var i=0;i<this.jsloaded.length;i++){
			if(this.jsloaded[i]!=1){	
				setTimeout("jvc.init_execute(\""+cb+"\",true)", 10);
				return;
			};
		}
		this.jsAllLoded=true;
		if(!cb)return;
		setTimeout(cb, 0);
	},

  include:function(namespace,useby){
	this.loadjs(this.baseUrl+namespace.replace(new RegExp("[.]","gm"),"/")+".js",useby);
	var str=namespace.split(".");
	var strP=str[0];
	for(var i=1;i<str.length-1;i++){
		strP+="."+str[i];
		eval("if(!"+strP+")"+strP+"=function(){};");
	}
  },
  
  loadjs:function(jsSrc,useby){
		//alert(jsSrc);
	if(useby && useby.indexOf(".js")==-1)useby=this.baseUrl+useby.replace(new RegExp("[.]","gm"),"/")+".js";
			
	var index=-1;
	for(var i=0;i<this.js.length;i++){		
		if(this.js[i]==jsSrc){
			index=i;if(this.jsloaded[index]==1)return;			
		}}
	
	if(index==-1){
		index=this.js.length;this.js[index]=jsSrc; this.jsuse[index]=useby; this.jsloaded[index]=-1;
  }
	if(useby){
		var useloaded=false;
	 	for(var i=0;i<this.jsloaded.length;i++)if(this.js[i].indexOf(useby)>-1 && this.jsloaded[i]==1)useloaded=true;	  
	  if(!useloaded)return;
	}
	
	this.jsloaded[index]=0;
	var oHead = document.getElementsByTagName('HEAD').item(0); 
	var oScript = document.createElement( "script" );
	
	oScript.src = jsSrc; 
	oScript.onload = oScript.onreadystatechange = function()    
				{    
				    if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")    
				     {
				     
				     jvc.loadjs_complete(index);}    
				}    
     oHead.appendChild( oScript ); 
     
},

	loadjs_complete:function(index){	
	 this.jsloaded[index]=1;
	 for(var i=0;i<this.js.length;i++){		
		if(this.jsloaded[i]==-1){			
			//alert(this.js[i]+"|"+this.jsuse[i]);
			this.loadjs(this.js[i],this.jsuse[i]);}
	}
},	
		
	loadcss:function(cssfile,id){
		//alert("loadcss:"+cssfile);
			if(!id)id="cssid_"+Math.random(); 
			var cssTag = document.getElementById(id);
		    var head = document.getElementsByTagName('head').item(0);
		    if(cssTag) head.removeChild(cssTag);
		    css = document.createElement('link');
		    css.href = cssfile;
		    css.rel = 'stylesheet';
		    css.type = 'text/css';
		    css.id = id;
		    head.appendChild(css);		

},
csspath : function(){
	var jvc_template="jvc"
	if(!this.CSSPATH)this.CSSPATH=jvc.baseUrl+"../css/"+jvc_template+"/";
	return this.CSSPATH;
},
//��ʾ��Ϣ
showMsg : function (msg,append) {
try{

	if (!msg) {msg="";}
	if (!$("jvcMsg")) {return;}
	
	if (!append) { $("jvcMsg").innerHTML = msg; return; }
	
	$("jvcMsg").innerHTML += "<br />" ;
	$("jvcMsg").innerHTML += msg ;

}catch(e){}
},

//��ʾ����
showErr : function (msg) {
try{

	if(jvc.debug) {jvc.showMsg(msg,true);}

}catch(e){}
},

 attachEvent:function(obj,sEvent,fun){
	    

    if(!this.notIE){
        obj.attachEvent("on"+sEvent,function(){
            fun.apply(obj,arguments);
        });
    }else{
    		
    	if(sEvent=="propertychange")sEvent="input";
        obj.addEventListener(sEvent,fun,false);
    }

},

 fireEvent:function(obj,sEvent){
	
   if(   document.all   )  
  {  
          obj.fireEvent("on"+sEvent);  
  }  
  else  
  {  
          var   evt   =   document.createEvent('HTMLEvents');  
          evt.initEvent(sEvent,true,true);  
          obj.dispatchEvent(   evt   );  
  }

}


	};
	
	
function $()
{ 
	var elements = new Array(); 
	for (var i = 0; i < arguments.length; i++)
	{ 
		var element = arguments[i]; 
		if (typeof element == 'string') 
			{var e = document.getElementById(element);
			if(!e){
			var   els   =   document.getElementsByTagName("*")   ;//ȡ������Ԫ�صļ��� 
        	for(var   ii=0;ii   <els.length;ii++){
        			if(els[ii].name==element)e=els[ii];
        		}   
			}
			element=e;
			} 
		if (arguments.length == 1) 
			return element; 
		elements.push(element); 
	} 
	return elements; 
};


function $$()
{ 
	var elements = new Array(); 
	for (var i = 0; i < arguments.length; i++)
	{ 
		var element = arguments[i]; 
		if (typeof element == 'string') 
			{var e = document.getElementById(element);
			if(!e){
			var   els   =   document.getElementsByTagName("*")   ;//ȡ������Ԫ�صļ��� 
        	for(var   ii=0;ii   <els.length;ii++){
        			if(els[ii].name==element)e=els[ii];
        		}   
			}
			element=e;
			} 
		if (arguments.length == 1) 
			return element; 
		elements.push(element); 
	} 
	return elements; 
};

function $$arr(name)
{ 
	var elements = new Array();
	var   els   =   document.getElementsByTagName("*")   ;//ȡ������Ԫ�صļ��� 
    for(var ii=0;ii<els.length;ii++){
       if(els[ii].name==name)elements.push(els[ii]); 
    }	
	return elements; 
};

function $$$(tag, parent){
	var child=document.createElement(tag);
	if(parent) {parent.appendChild(child) }
	return child;
};

	var jvcbaseUrl;
	
	var scripts = document.getElementsByTagName("script");
for(var i=0;i<scripts.length;i++){
	if(/.*\/jvc\.js$/g.test(scripts[i].getAttribute("src")))jvcbaseUrl=scripts[i].getAttribute("src");
		
	}
	
	if(!jvcbaseUrl){
		if(document.all)jvcbaseUrl=document.all["jvcscript"].src;
		else jvcbaseUrl=$$('jvcscript').src;
	}
	var pos=jvcbaseUrl.lastIndexOf("/");
	if(pos>=0) jvcbaseUrl = jvcbaseUrl.substring(0,pos)+"/"; else jvcbaseUrl="";	
	jvc.baseUrl=jvcbaseUrl;
	jvc.include("jvc.ui");	
			
var jvc_ready=function(cb,isAuto) {
 
	if(document.addEventListener) 
	document.addEventListener("DOMContentLoaded",function() { 
	document.removeEventListener("DOMContentLoaded",arguments.callee,false); 
	jvc.init_execute(cb,isAuto); 
	},false); 
	else if(document.attachEvent) {//for IE 
	if(document.documentElement.doScroll && window.self==window.top) { 
	(function() { 
	
	try { 
	document.documentElement.doScroll("left"); 
	}catch(ex) { 
	setTimeout(arguments.callee,5); 
	return; 
	} 
		
	jvc.init_execute(cb,isAuto); 
	
	})(); 
	}else {//maybe late but also for iframes 
	
	document.attachEvent("onreadystatechange",function() { 
	
	if(document.readyState==="complete") { 
	document.detachEvent("onreadystatechange", arguments.callee); 
	jvc.init_execute(cb,isAuto); 
	} 
	}); 
	} 
	} 
}


function showWait(){
		 document.write("<div id='_JVCHTMLBGDiv' style='background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:999999;text-align:center;text-valign:middle'></div>");
}

function hiddenWait(index){
	$$("_JVCHTMLBGDiv").style.display="none";
}
showWait();